#!/usr/bin/env python
#coding=utf8

import random
class Skill(object):
    def __init__(self,player,enemy):
        self.player = player
        self.enemy = enemy
        
        attpoint = 20
        kopoint = 50
        self.oldLV = self.player.heroLV
        
        if enemy.isOver():
            player.exp += kopoint
        else:
            player.exp += attpoint
        self.Upgrade()
        
    def Upgrade(self):
        if self.oldLV != self.player.heroLV :
            '''升级增加人物属性'''
            self.player.hp +=1
            self.player.mov +=1
            self.player.atk +=1
            self.player.defend+=1
            n=random.randint(1,100)
            if n<20 :
                self.player.hp  +=1
            elif n>=20 and n<40 :
                self.player.mov +=1
            elif n>=40 and n<60 :
                self.player.atk +=1
            elif n>=60 and n<80 :
                self.player.defend +=1

